package lq1372;

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int S = scan.nextInt();
		int[] arr = new int[n];
		int sum = 0;
		int ans = Integer.MAX_VALUE;
		for (int i = 0; i < n; i++) {
			arr[i] = scan.nextInt();
		}
		
		for (int i = 0, j = 0; i < n;) {
			System.out.printf("[%d,%d]\n", i,j);
			if (sum < S) {
				sum += arr[i];
				i++;
			} else {
				ans = Math.min(i - j, ans);
				sum -= arr[j];
				j++;
			}
		}
		if (ans == Integer.MAX_VALUE) {
			System.out.print(0);
		} else {
			System.out.print(ans);
		}
		scan.close();
	}
}